<?php

/* 
 *------------------------------------------------------------------------------
 * Project Name  : e-Synergy Library System
 *         Code  : ESN-LBS
 *
 * Created By    : Junlapong
 *         Date  : 2010/01/15 12:00
 * 
 * $Id$
 *------------------------------------------------------------------------------
 *    copyright: e-Synergy Co., Ltd.
 *==============================================================================
 */

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 
 * translate keyword to langauge
 * 
 * lang:
 * $lang['msg_0001'] = 'Please enter %s between %d and %d'
 * 
 * usage:
 * lang('msg_0001', 'field name', 1, 99);
 * 
 * result:
 * Please enter field name between 1 and 99
 *
 * @access	public
 * @param	string keyword for translate
 * @param	string paramx for replace in word
 * 
 * @return	string
 */	
if ( ! function_exists('lang'))
{
	function lang($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
	{		
		$CI =& get_instance();
		$line = $CI->lang->line($key);
		
		if (! is_empty($param5))
		{
			$line = sprintf($line, $param1, $param2, $param3, $param4, $param5);
		}
		elseif (! is_empty($param4))
		{
			$line = sprintf($line, $param1, $param2, $param3, $param4);
		}
		elseif (! is_empty($param3))
		{
			$line = sprintf($line, $param1, $param2, $param3);
		}
		elseif (! is_empty($param2))
		{
			$line = sprintf($line, $param1, $param2);
		}
		elseif (! is_empty($param1))
		{
			$line = sprintf($line, $param1);
		}

		return $line;
	}
}

// ------------------------------------------------------------------------
/* End of file MY_language_helper.php */
/* Location: application/helpers/MY_language_helper.php */